473,468 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Combine regular expression validator with javascript function?

Hello.

Say I have a .net textbox that uses a .net regularexpressionvalidator.
If the regular expression fails, is it possible to launch a small
client side javascript function to do something, such as change the
border color of the textbox to red? That would look quite nice: if
the expression fails, the red validator text is shown, plus the
textbox's border goes red.

TIA,
-dnw.
Nov 18 '05 #1
2 9838
I was not able to somehow combine the regular expression validator
control with a client side javascript function, so instead I took the
regular expression that I needed and put it inside a custom validator
client side function, then added on some extra javascript that changed
the textbox border to red.

-dnw.

do***@hotmail.com (Dot net work) wrote in message news:<77**************************@posting.google. com>...
Hello.

Say I have a .net textbox that uses a .net regularexpressionvalidator.
If the regular expression fails, is it possible to launch a small
client side javascript function to do something, such as change the
border color of the textbox to red? That would look quite nice: if
the expression fails, the red validator text is shown, plus the
textbox's border goes red.

TIA,
-dnw.

Nov 18 '05 #2
There is a solution that avoids rewriting every validator. It requires using
a replacement to Microsoft's validators that is designed to handle this kind
of communication. Microsoft's validators are limited to showing an error
message in the location of the validator. There are other ways to
communicate to the user: setting focus to the field, changing the field,
label or background color, blinking the error message and putting up an
alert. "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx) has all of these capabilities
supporting its 22 validators. Its designed to avoid writing custom code and
hacks due to the many limitations of Microsoft's validators.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
"Dot net work" <do***@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
I was not able to somehow combine the regular expression validator
control with a client side javascript function, so instead I took the
regular expression that I needed and put it inside a custom validator
client side function, then added on some extra javascript that changed
the textbox border to red.

-dnw.

do***@hotmail.com (Dot net work) wrote in message

news:<77**************************@posting.google. com>...
Hello.

Say I have a .net textbox that uses a .net regularexpressionvalidator.
If the regular expression fails, is it possible to launch a small
client side javascript function to do something, such as change the
border color of the textbox to red? That would look quite nice: if
the expression fails, the red validator text is shown, plus the
textbox's border goes red.

TIA,
-dnw.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: VSK | last post by:
Hi all, I have a .ascx file with dropdownbox (SSN, EmpName) textbox submit button regular expression validator( controltovalidate is the above textbox) Now i want to change the Regular...
2
by: S.Kartikeyan | last post by:
I have the following problem. I am using the follwing Regular Expression validator(REV) with validator expressions ^{1,2}$ ^{3,20}$ The idea of the first exp is 1 or 2 digits the idea of second...
7
by: Steve | last post by:
Hi I have a regular expression validator for my username field which just allows 3 to 30 characters without spaces to be inputted by the user. ^\S{3,30}$ How can I add to this expression not...
1
by: vtxr1300 | last post by:
I'm having a problem with a regular expression in conjunction with the regular expression validator. I am trying to make sure that when a user browses for a file to upload, it ends in gif, jpeg or...
1
by: Zorik | last post by:
I am building a form in asp.net 2.0 On one of the textboxes, I don't want that the user will use the space character. How do I disallow space using regular expression validator (or other...
2
by: meena83 | last post by:
how to write a expression in Regular Expression Validator for -- a word that entered in a textbox must be ->first letter caps and all others small ->should not accept digits and special...
6
by: David | last post by:
I'm having trouble getting the regular expression validator to work with a text box. In this simple example I only want lower case letters to be allowed. So I tried the following and it doesn't...
0
by: durga2005 | last post by:
hi i just added one textbox and regular expression validator in the form and set the properties for regular expression validator control. then i placed these two controls inside update panel ....
1
by: durga2005 | last post by:
hi i have a textbox and regular expression validator control .i have placed these control inside update panel. just im validating the textbox with regular expression validator control when i...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.